package com.syy.statisticalresults;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class GradeReducer extends Reducer<Grade, NullWritable, Grade, NullWritable> {
    private int rank = 1;
    @Override
    protected void reduce(Grade key, Iterable<NullWritable> values, Reducer<Grade, NullWritable, Grade, NullWritable>.Context context) throws IOException, InterruptedException {
        key.setRank(rank);
        context.write(key, NullWritable.get());
        rank++;
    }
}
